package belf.migrate.engine.job;

import belf.migrate.api.common.DatabaseIdentifier;
import belf.migrate.api.sink.jdbc.JdbcSink;
import belf.migrate.api.taskconf.JobContext;
import belf.migrate.api.taskconf.TaskConf;
import belf.migrate.plugin.dameng.DamengSink;
import belf.migrate.plugin.kingbase.KingbaseSink;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class JdbcSinkCreator {
    public static JdbcSink createSink(JobContext jobContext) {
        switch (jobContext.getTaskConf().getSinkConf().getCatalogName()) {
            case DatabaseIdentifier.DAMENG:
                return new DamengSink(jobContext);
            case DatabaseIdentifier.KINGBASE:
                return new KingbaseSink(jobContext);
            default:
                log.error("Fatal Error!!!No Valid JdbcSink Found For {}!!!", jobContext.getTaskConf().getSinkConf().getCatalogName());
                return null;
        }

    }
}
